package com.fullstuck.demo;

import com.fullstuck.service.UserService;
import com.fullstuck.service.impl.StudentServiceimpl;
import com.fullstuck.service.impl.UserServiceimpl;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 在这里模拟前台，进行方法调用
 */
public class Controller {
    public static void main(String[] args) {

        //普通实现
//        UserService user = new UserServiceimpl();
//        user.eat();
        //Spring user
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userservice = (UserService) context.getBean("userservice");
        userservice.eat();


        ClassPathXmlApplicationContext context1 = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentServiceimpl studentserviceimpl = (StudentServiceimpl) context1.getBean("studentserviceimpl");
        studentserviceimpl.dostudy();
    }



}
